//
//  JokeImageViewController.m
//  Quick_News
//
//  Created by silently on 15-2-6.
//  Copyright (c) 2015年 zkj. All rights reserved.
//

#import "JokeImageViewController.h"
#import "UIImageView+WebCache.h"
@interface JokeImageViewController ()

@end

@implementation JokeImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self createView];
}


- (void)createView
{
    self.myImageView = [[UIImageView alloc] init];
    
    [self.myImageView.layer setCornerRadius:7];
    [self.view addSubview:self.myImageView];
    [self.myImageView release];
    
    
    
    self.digestLabel = [[UILabel alloc] init];
    [self.view addSubview:self.digestLabel];
    self.digestLabel.numberOfLines = 0;
    //    self.digestLabel.backgroundColor = [UIColor orangeColor];
    //    self.digestLabel.alpha = 0.5;
    [self.digestLabel sizeToFit];
    [self.digestLabel release];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.view addSubview:self.titleLabel];
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.titleLabel release];
    
    
    
    [self addViews];
    
}



- (void)addViews
{
    

    self.myImageView.frame = CGRectMake(10, 60, self.view.frame.size.width - 20, 300);
    self.myImageView.clipsToBounds = YES;
    [self.myImageView setImageWithURL:[NSURL URLWithString:self.jokes.img]];

    
    
    self.titleLabel.frame = CGRectMake(10, 30, self.view.frame.size.width - 20, 30);
    self.titleLabel.text = self.jokes.title;
    
    
    
    
    self.digestLabel.frame = CGRectMake(10, 360, self.view.frame.size.width - 20, 200);
    self.jokes.digest = [self.jokes.digest stringByReplacingOccurrencesOfString:@"（动态图可点击进入查看哦~！）." withString:@""];
    self.jokes.digest = [self.jokes.digest stringByReplacingOccurrencesOfString:@" &quot;" withString:@""];
    self.digestLabel.text = self.jokes.digest;
    self.digestLabel.font = [UIFont systemFontOfSize:18];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)dealloc
{
    [_digestLabel release];
    [_titleLabel release];
    [_jokes release];
    [_myImageView release];
    [super dealloc];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
